package com.yidu.ruifeng_logistics.service.impl;

import com.yidu.ruifeng_logistics.entity.LogisticsUserRole;
import com.yidu.ruifeng_logistics.dao.LogisticsUserRoleDao;
import com.yidu.ruifeng_logistics.service.LogisticsUserRoleService;
import com.yidu.ruifeng_logistics.vo.LogisticsUserRoleVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 用户角色表(LogisticsUserRole)表服务实现类
 *
 * @author 张皓超
 * @since 2021-03-11 11:15:57
 */
@Service("logisticsUserRoleService")
public class LogisticsUserRoleServiceImpl implements LogisticsUserRoleService {
    @Resource
    private LogisticsUserRoleDao logisticsUserRoleDao;

    /**
     * 通过ID查询单条数据
     *
     * @param suserRoleId 主键
     * @return 实例对象
     */
    @Override
    public LogisticsUserRole queryById(Integer suserRoleId) {
        return this.logisticsUserRoleDao.queryById(suserRoleId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<LogisticsUserRole> queryAllByLimit(int offset, int limit) {
        return this.logisticsUserRoleDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param logisticsUserRole 实例对象
     * @return 实例对象
     */
    @Override
    public LogisticsUserRole insert(LogisticsUserRole logisticsUserRole) {
        this.logisticsUserRoleDao.insert(logisticsUserRole);
        return logisticsUserRole;
    }

    /**
     * 修改数据
     *
     * @param logisticsUserRole 实例对象
     * @return 实例对象
     */
    @Override
    public LogisticsUserRole update(LogisticsUserRole logisticsUserRole) {
        this.logisticsUserRoleDao.update(logisticsUserRole);
        return this.queryById(logisticsUserRole.getSuserRoleId());
    }

    /**
     * 通过主键删除数据
     *
     * @param suserRoleId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer suserRoleId) {
        return this.logisticsUserRoleDao.deleteById(suserRoleId) > 0;
    }

    @Override
    public List<LogisticsUserRole> queryAll(LogisticsUserRole logisticsUserRole) {
        return this.logisticsUserRoleDao.queryAll(logisticsUserRole);
    }

    @Override
    public List<LogisticsUserRole> queryStaffIdReturnObj(Integer staffId) {
        return this.logisticsUserRoleDao.queryStaffIdReturnObj(staffId);
    }

    @Override
    public List<LogisticsUserRoleVo> queryStaffIdReturnLiseObj() {
        return logisticsUserRoleDao.queryStaffIdReturnLiseObj();
    }


}
